package org.check.multiThread;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;

import org.check.VO.DBParaVO;
import org.check.potimize.business.LoadBaseCourseUser;
import org.check.potimize.business.MapLoader;

public class CntThread extends Thread {
	private DBParaVO vo;
	private HashMap<String, String> map;
	
	public CntThread(DBParaVO vo){
		super();
		this.vo = vo;
	}  
	
	public DBParaVO getVo() {
		return vo;
	}
	public void setVo(DBParaVO vo) {
		this.vo = vo;
	}
	public HashMap<String, String> getMap() {
		return map;
	}
	public void setMap(HashMap<String, String> map) {
		this.map = map;
	}
	
	@Override
	public void run() {  
		setMap(loadMap(this.getVo()));
		LoadBaseCourseUser.putValue2Obj(getMap(), this.getVo().getTablename());
    }
	
	public static HashMap<String, String> loadMap(DBParaVO vo) {
		HashMap<String, String> map = new HashMap<String, String>();
		ResultSet rs = null;
		rs = MapLoader.load(vo);
		map = MapLoader.getMapList(rs);
		return map;	
	}	
	
}
